<div class="slide code_highlight_slide">
	<span class="section">Tip #2: Keep controllers simple</span>
	<h1>Implement inheritence pattern using Class.js utility</h1>
	<pre class="highlightjs">
		<code>var BaseController = Class.extend({
		$scope:null,

		init:function($scope){
			this.$scope = $scope;
			this.defineListeners();
			this.defineScope();
		},

		defineListeners:function(){
			this.$scope.$on('$destroy',this.destroy.bind(this));
		},

		defineScope:function(){
			//OVERRIDE : Create all scope properties here to keep track of them.
		},

		destroy:function(event){
			//OVERRIDE : Remove all listeners, all timeouts and intervals
		}
})
BaseController.$inject = ['$scope'];





//NotesController.js
var NotesController = BaseController.extend({

	_notifications:null,
	_notesModel:null,
	
	init:function($scope,NotesModel,Notifications,$route){
		this._super($scope)
		this._notifications = Notifications;
		this._notesModel = NotesModel;
		this._notesModel.loadSlides();
	},

	defineListeners:function(){
		this._super();
		this._notifications.addEventListener(notes.slide.events.TRANSITION_END,...);
		this._notifications.addEventListener(ui.navigation.events.PREVIOUS,...);
		this._notifications.addEventListener(ui.navigation.events.NEXT,...);
	},

	[...]

})
</code>
	</pre>
	<span class="credits">ClassUtility by John Resig ~ <a href="http://ejohn.org/blog/simple-javascript-inheritance/">http://ejohn.org/blog/simple-javascript-inheritance/</a></span>
</div> 